#pragma  once

namespace Graphics{
	class GUIManager{
	public:
		GUIManager():m_initialized(false),m_injectInput(true){}
		virtual ~GUIManager(){}

		virtual void initializeManager(RenderContextPtr context) = 0;
		virtual void render(RenderContextPtr context) = 0;
		virtual void injectKeyInput(Input::KeyDefinition key, bool down) = 0;
		virtual void injectMouseInput(float x,float y) = 0;
		virtual void showCursor(bool var) = 0;
		virtual void showGUI(bool var) = 0;
		
		// Window functions
		virtual bool getVisible(std::string name) = 0;
		virtual void setVisible(std::string name, bool var) = 0;
		virtual void setText(std::string name, std::string text) = 0;

		// List functions
		virtual void clearList(std::string listBox) = 0;
		virtual void addListBoxItem(std::string listBox, std::string itemName) = 0;
		virtual void removeListBoxItem(std::string listBox, std::string itemName) = 0;
		virtual std::string getSelectedItemFromList(std::string listName) = 0;

		// Button functions
		virtual void subscribeToButtonClick(std::string buttonName, boost::function<void(void)> func) = 0;

		void setInputInjection(bool var){ m_injectInput = var; }
	protected:
		void checkInitialization() { while(!m_initialized){} }

		bool	m_initialized,
				m_injectInput;
		std::vector<std::pair<float,float>> m_mouseMovements;
		std::vector<std::pair<Input::KeyDefinition,bool>> m_keyPresses;
		MutexPtr m_inputMutex;
	};
}

typedef boost::shared_ptr<Graphics::GUIManager> GUIManagerPtr;